package cn.wizzer.app.sys.modules.services.impl;

import cn.wizzer.app.sys.modules.models.Sys_lang_local;
import cn.wizzer.app.sys.modules.services.SysLangLocalService;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import com.alibaba.dubbo.config.annotation.Service;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;

import java.util.List;

@IocBean(args = {"refer:dao"})
@Service(interfaceClass = SysLangLocalService.class)
public class SysLangLocalServiceImpl extends BaseServiceImpl<Sys_lang_local> implements SysLangLocalService {
    public SysLangLocalServiceImpl(Dao dao) {
        super(dao);
    }

    public List<Sys_lang_local> getLocal() {
        return this.query(Cnd.where("disabled", "=", false).asc("location"));
    }

    public String getLocalJson() {
        return Json.toJson(this.query(Cnd.where("disabled", "=", false).asc("location")),
                JsonFormat.full().setActived("locale|name"));
    }
}
